﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeBehind="Rubric.aspx.cs" Inherits="Nivdal.Rubric"  StylesheetTheme="SkinFile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadPlaceHolder" runat="server">
    <script language="javascript" type="text/javascript">
        function redirectToStory(storyId) {
            window.location = "Story.aspx?StoryId=" + storyId;
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:HiddenField ID="RubricIdHiddenField" runat="server" />
    <asp:Panel ID="NewspaperDirPanel" runat="server">
        <div class="basic_element">
        <div class="red_title">
            <asp:Label ID="RubricNameTitleLabel" runat="server" CssClass="white_title"></asp:Label>
        </div>
        <div class="newspaperTitle">
            <div class="NewspaperTitleStyle rounded_corners floater">
                <asp:HyperLink ID="ShowAllHyperlnk"  runat="server" Text="<%$ Resources:Resource, Newspaper_AllShowAllTitle %>"></asp:HyperLink>
            </div>
            <asp:Repeater ID="RubricsRepeater" runat="server" DataSourceID="RubricsDataSource">
            <ItemTemplate>                    
                <div class='<%# GetRubricTitleClass(Eval("rubricId")) + " floater rounded_corners" %>' >
                    <asp:HyperLink ID="RubricHyperlink" runat="server" Text='<%# Eval("RubricName") %>'
                    NavigateUrl='<%# "~/Rubric.aspx?Id=" + Eval("rubricId") %>' style="white-space:nowrap;"></asp:HyperLink>
                </div>                    
            </ItemTemplate>
            </asp:Repeater>
            <div class="clearBoth"></div> 
        </div>
        <div class="padding5">
                
        <asp:Panel ID="OuterAdminPanel" runat="server">
        <asp:Panel ID="AddStoryPanel" runat="server" Visible="false">
            <asp:HyperLink ID="AddStoryHyperLink" NavigateUrl="~/AddStory.aspx" CssClass="reg_text red_inline_text" Text="<%$ Resources:Resource, NewsPaper_AddStoryLink %>" runat="server"></asp:HyperLink>
            <br />
        </asp:Panel> 
        <asp:Panel ID="AdminPanel" runat="server" Visible="false">
            <asp:HyperLink ID="AdminHyperlink" runat="server" NavigateUrl="~/NewspaperAdmin.aspx" 
                Text="<%$ Resources:Resource, NewsPaper_AdminTitle %>" CssClass="reg_text red_inline_text"></asp:HyperLink>
            <br />
        </asp:Panel>
            
        </asp:Panel> 
        <br /><br />
        <asp:Label ID="RubricDescriptionLabel" runat="server" SkinID="GridLabel"></asp:Label>
                
        
        <br /><br />

   <asp:Repeater ID="StoriesRepeater" runat="server" DataSourceID="NewsPaperTopStoriesDataSource">
        <HeaderTemplate>
        <div class="tbl">
        </HeaderTemplate>
        <ItemTemplate>
        <div class="tblr" >
        <div class="tblc NewspaperStoryTDstye padding5">
            <div onclick='<%# "javascript:redirectToStory(" + Eval("Id") + ")" %>' class="rounded_corners">
                <asp:Image ID="StoryImage" runat="server" ImageUrl='<%# Eval("Image") %>' CssClass="rounded_corners"
                AlternateText="<%$ Resources:Resource, NewsPapar_Image %>" Width="120"  onerror="this.src='Images/menupicture.gif';" />        
            </div>
        </div>
        <div class="tblc NewspaperStoryTDstye padding5">
            <div onclick='<%# "javascript:redirectToStory(" + Eval("Id") + ")" %>'>
                <%--<asp:Label ID="StoryTitleLabel" runat="server" Text='<%# Eval("Title") %>' SkinID="TeamNameLabel" CssClass="NewspaperStoryTitle"></asp:Label>--%>
                <asp:Hyperlink ID="StoryHyperlink" Text='<%# Eval("Title") %>' runat="server" NavigateUrl='<%# "Story.aspx?StoryId=" + Eval("Id") %>'
                 CssClass="NewspaperStoryTitle"></asp:Hyperlink>
                 &nbsp;
                <asp:Image ID="IsNewImage" runat="server" ImageUrl="~/Images/Icons/New_icons_32.gif" Visible='<%# Eval("IsNew") %>' />
                <br />
                <asp:Label ID="SubtitleLabel" runat="server" Text='<%# Eval("SubTitle") %>' SkinID="GridLabel"></asp:Label>
                
                <asp:HyperLink ID="RubricHyperlink" runat="server" Text='<%# "(" + Eval("RubricName") + ")" %>'
                 SkinID="BlackHyperLinkSkin" CssClass="NewsPaperRubricPreview" NavigateUrl='<%# "~/Rubric.aspx?Id=" + Eval("RubricId") %>'></asp:HyperLink>            
                 <br />
                <asp:Label ID="DateLabel" runat="server" Text='<%# Eval("Date") %>' SkinID="GridLabel"></asp:Label>      
                <asp:HyperLink ID="AuthorHyperlink" runat="server" NavigateUrl='<%# "~/UserPage.aspx?Id=" + Eval("AuthorId") %>'
                 Text='<%# Eval("AuthorName") %>' SkinID="GreenTitleHyperLink"></asp:HyperLink>
                <br />
                <asp:Label ID="NumTalkbacksLabel" runat="server" SkinId="GridLabel"
                Text='<%# Eval("NumTalkbacks") + " " + Resources.Resource.Newspaper_TalkBacks %>'></asp:Label>
                <br />
                <asp:Image ID="EvaluationsImage" runat="server" ImageUrl='<%# "~/Images/NewsPaper/" + Eval("Evaluation") + "star.png" %>'
                 ToolTip='<%# Resources.Resource.Newspaper_StoryRatingTitlePart1 + " " + Eval("EvaluationCount") + " " +  Resources.Resource.Story_RightSideRatedStory + " " + Eval("ExactEvaluation") %>' />
            </div>
        </div>        
        </div>
               
        </ItemTemplate>
        <FooterTemplate>
            </div>
        </FooterTemplate>
        </asp:Repeater>
    <asp:SqlDataSource ID="RubricsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_GetNewsPaperRubrics" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:QueryStringParameter Name="RubricId" QueryStringField="Id" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="NewsPaperTopStoriesDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="Nivdal_GetRubricStories" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:QueryStringParameter Name="RubricId" QueryStringField="Id" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    </div></div>
    </asp:Panel>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PageNamePlaceHolder" runat="server">
    <asp:Label ID="PageNameLabel" runat="server" Text="<%$ Resources:Resource, Newspaper_PageName %>" CssClass="PageNameContentStyle"></asp:Label>
</asp:Content>
